<template>
    <div>
        <h3>当前最新的count值为：{{count}}</h3>
        <button @click="sub">-1</button>
        <input v-model="N">
        <button @click="subN(N)">-N</button>
        <button @click="subAsync">一秒后-1</button>
        {{showNum}}
    </div>
</template>

<script>
    import {mapState,mapMutations,mapActions,mapGetters} from 'vuex'
    export default {
        data(){
            return {
                N:'',
            }
        },
        computed:{
            ...mapState([
                "count",
            ]),
            ...mapGetters([
                'showNum'
            ])
        },
        methods:{
            ...mapMutations(['sub','subN']),
            ...mapActions(['subAsync'])
        }
    }
</script>

<style scoped>

</style>